package com.control 
{
	import com.event.EventManager;
	import com.event.PublicEvent;
	import components.Button;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author wen
	 */
	public class Menu 
	{
		public var view:MovieClip;
		
		private var _btn0:Button;
		private var _btn1:Button;
		private var _btn2:Button;
		
		public function Menu(mc:MovieClip) 
		{
			view = mc;
			
			init();
		}
		
		public function init():void 
		{
			_btn0 = new Button(view.btn0);
			_btn1 = new Button(view.btn1);
			_btn2 = new Button(view.btn2);
			
			_btn0.addEventListener(MouseEvent.CLICK, onClickHander);
			_btn1.addEventListener(MouseEvent.CLICK, onClickHander);
			_btn2.addEventListener(MouseEvent.CLICK, onClickHander);
		
			_btn0.label = "Start";
			_btn1.label = "Rank";
			_btn2.label = "Help";
		}
		
		private function onClickHander(e:MouseEvent):void 
		{
			switch(e.currentTarget)
			{
				case _btn0:
					EventManager.instance.dispatchEvent(new PublicEvent(PublicEvent.START));
					break;
				case _btn1:
					break;
				case _btn2:
					break;
			}
		}
		
		
		public function show():void 
		{
			view.visible = true;
		}
		
		public function hide():void 
		{
			view.visible = false;
		}
		
		
	}

}